package real

import (
	"io"
	"net/http"
	"time"
)

type Retriever struct {
	Timeout time.Duration
}

func (r *Retriever) Get(url string) (string, error) {
	cli := http.Client{
		Timeout: r.Timeout,
	}

	resp, err := cli.Get(url)

	if err != nil {
		return "", err
	}

	defer resp.Body.Close()

	buf, err := io.ReadAll(resp.Body)
	if err != nil {
		return "", err
	}
	return string(buf), nil
}
